<script type='text/javascript'>

$('.kunjungan_block, .last_kunjungan_block').click(function(e){
	window.location.href = $(this).find('.link a').attr('href');
});

$('#tambah_kunjungan input[type="submit"]').click(function(e){
	e.preventDefault();
	var form = $('#tambah_kunjungan');
	$.ajax({
		type: 'POST',
		dataType: 'json',
		url: form.attr('action'),
		data: form.serializeArray(), 
		success: function(data){
			if(data.status == 'sukses'){
				window.location.href = '<?php echo current_url() ?>';
			} else {
				$('#error_info').find('div').html(data.error);
				$('#error_info').show();
			}
		}
	});
});

$('#tambah_kunjungan_menu').click(function(e){
	e.preventDefault();
	$('#tambah_kunjungan_block').toggle();
});

</script>
